home *** CD-ROM | disk | FTP | other *** search
/ Multimedia Business 500 #2 / Multimedia Business 500 - Release 2.iso / startup.mst < prev    next >
Text File  |  1995-01-15  |  16KB  |  494 lines

  1. '**************************************************************************
  2. '*
  3. '* TITLE.MST - Viewer Runtime Setup Script
  4. '*
  5. '* CUSTOMIZING TITLE.MST
  6. '*
  7. '* For a simple Setup routine, you just need to assign values to the 
  8. '* series of variables following the heading "Setup Variables". This
  9. '* script also provides for the following more-advanced options, which
  10. '* are supported by subroutines located later in this script:
  11. '*
  12. '* Option                                         See Subroutine
  13. '* ------------------------------------------     ---------------------
  14. '* Install more than one .MVB file                ModifyViewerIni
  15. '* Install Help title                             ModifyViewerIni
  16. '* Install custom DLLs                            ModifyViewerIni
  17. '* Install multiple Program Manager items         ModifyProgramManager
  18. '* Display a custom icon with the ProgMan item    ModifyProgramManager
  19. '* Install custom fonts                           RegisterCustomFonts
  20. '* Install Video for Windows runtime files        RegisterDrivers
  21. '*
  22. '* Each customization note starts with the heading CUSTOMIZATION.
  23. '*
  24. '**************************************************************************
  25.     
  26.     '' Global variables
  27.  
  28.     GLOBAL TitleShortName$
  29.     GLOBAL TitleLongName$
  30.     GLOBAL CATMVB$
  31.     GLOBAL MVB$
  32.     GLOBAL PromptForPath%
  33.     GLOBAL DefaultPath$
  34.     GLOBAL ProgManGroup$
  35.     GLOBAL ProgManItem$
  36.     GLOBAL CatProgManItem$
  37.     
  38.     '' ****************************************************************
  39.     '' ** Setup Variables
  40.     '' ****************************************************************
  41.  
  42.     '' Set the following string to a short form of the title name
  43.     '' (for example, "Gallery")
  44.     
  45.     TitleShortName$ = "Allegro Multimedia Business 500"
  46.     
  47.     '' Set the following string to a long form of the title name
  48.     '' (for example, "Viewer 2.0 Gallery")
  49.     
  50.     TitleLongName$ = "Allegro New Media Multimedia Business 500"
  51.         
  52.     '' Set the following variable to the name of the MVB file, without 
  53.     '' the filename extension (for example, "GALLERY")
  54.         
  55.     MVB$ = "BUS500\BUSOPEN"
  56.  
  57.     CATMVB$ = "BUS500\CATALOG"
  58.  
  59.     '' The following variable determines whether Setup prompts the user
  60.     '' to specify a directory in which to install title files. (Files
  61.     '' to be installed on the hard disk must be listed in the TITLE.INF 
  62.     '' file under the [Installed Title Files] section.) Specify one of
  63.     '' the following values:
  64.     ''
  65.     '' 0    Install title files in the Windows directory (default setting).
  66.     ''      This is an appropriate setting if you have a limited number
  67.     ''      of files to copy (for example, a single custom icon or DLL).
  68.     ''
  69.     '' 1    Display a dialog box to prompt the user for a directory in 
  70.     ''      which to install files
  71.         
  72.     PromptForPath% = 0
  73.         
  74.     '' If you have specified 1 in PromptForPath%, set the following 
  75.     '' variable to the default path that will be displayed in the dialog
  76.     '' box (for example, "C:\GALLERY").
  77.         
  78.     DefaultPath$ = ""
  79.     
  80.     '' Set the following variable to the name of the program manager 
  81.     '' group you would like to create (for example, "Viewer 2.0 Gallery")
  82.         
  83.     ProgManGroup$ = "Allegro Reference"
  84.     
  85.     '' Set the following variable to the caption of the program manager 
  86.     '' item for your title (for example, "Gallery")
  87.         
  88.     ProgManItem$ = "Allegro Multimedia Business 500"
  89.  
  90.     CatProgManItem$ = "Allegro New Media Catalog"
  91.     
  92.     '***********************************************************************
  93.     '** Mainline
  94.     '***********************************************************************
  95.  
  96.     GLOBAL CUIDLL$
  97.  
  98.     '' Include files
  99.     '$INCLUDE 'setupapi.inc'
  100.     
  101.     '' Custom UI dll
  102.     CUIDLL$ = "mscuistf.dll"
  103.     
  104.     '' Dialog ID's
  105.     CONST DESTPATH      = 1000
  106.     CONST APPHELP       = 2000
  107.     CONST TOOBIG        = 3000
  108.     CONST BADPATH       = 4000
  109.     CONST SUCCESS       = 5000
  110.     
  111.     '' Bitmap ID
  112.     CONST LOGO = 1
  113.     
  114.     '' Functions and subroutines
  115.     DECLARE FUNCTION AddFont LIB "mscuistf.dll" (szFont$, szName$) AS INTEGER
  116.     DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  117.     DECLARE FUNCTION GetTitleDir (szDefault$) AS STRING
  118.     DECLARE FUNCTION CopyFiles(szTitleDir$) AS INTEGER
  119.     DECLARE SUB RegisterFont(fontfile$, fontname$)
  120.     DECLARE SUB ModifyViewerIni
  121.     DECLARE SUB RegisterCustomFonts
  122.     DECLARE SUB ModifyProgramManager
  123.     DECLARE SUB ShowSuccess
  124.     DECLARE SUB RegisterDrivers
  125.     
  126.     '' The following statement turns size checking off. Set it to scmOnFatal 
  127.     '' to enable size checking, where Setup will compare the disk file size 
  128.     '' with the INF file size and report an error if they are not the same.
  129.     
  130.     i% = SetSizeCheckMode(scmOff)
  131.     
  132.     '' Set the title and banner bitmap. You must rebuild MSCUISTF.DLL to 
  133.     '' alter the banner bitmap.
  134.     
  135.     SetTitle "Allegro Multimedia Business 500 Setup"
  136.     SetBitmap CUIDLL$, LOGO 
  137.     
  138.     '' Read in the INF file.
  139.     
  140.     ReadInfFile GetSymbolValue("STF_CWDDIR") + "TITLE.INF"
  141.     
  142.     '' Decide where to put title files
  143.     IF PromptForPath% = 1 THEN
  144.         szTitleDir$ = GetTitleDir(DefaultPath$)
  145.         IF szTitleDir$ = "" THEN
  146.             GOTO QUIT
  147.         ENDIF
  148.     ELSE
  149.         szTitleDir$ = GetWindowsDir()
  150.     ENDIF   
  151.     
  152.     '' Copy files
  153.     IF CopyFiles(szTitleDir$) = 0 THEN
  154.         GOTO QUIT
  155.     ENDIF
  156.  
  157.     '' Create the MVIEWER2.EXE MVB association 
  158.     CreateIniKeyValue "WIN.INI", "Extensions", "MVB", "mviewer2.exe", cmoNone
  159.  
  160.     '' Register in VIEWER.INI
  161.     ModifyViewerIni
  162.  
  163.     '' Register custom fonts
  164.     RegisterCustomFonts
  165.  
  166.     '' Register drivers
  167.     RegisterDrivers
  168.     
  169.     '' Modify Program Manager
  170.     ModifyProgramManager    
  171.     
  172.     '' Success dialog
  173.     ShowSuccess
  174.     
  175.     RUN MakePath(GetSymbolValue("STF_SRCDIR"),"rstwin.exe Allegro Restart "),NOWAIT   
  176.     '' Now start the title
  177.  
  178.     '' RUN "mviewer2.exe " + MVB$ + ".MVB", NOWAIT
  179.  
  180. QUIT:
  181.     
  182.     END
  183.     
  184.  
  185. '*************************************************************************
  186. '** Purpose:
  187. '**     Prompts the user for a path for the title files
  188. '** Arguments:
  189. '**     szDefault$ - default path
  190. '** Returns:
  191. '**     New valid path name, or "" if the user quit.
  192. '*************************************************************************
  193.  
  194. FUNCTION GetTitleDir (szDefault$) STATIC AS STRING
  195.  
  196.     SetSymbolValue "String", TitleShortName$
  197.     SetSymbolValue "EditTextIn", szDefault$
  198.     SetSymbolValue "EditFocus", "ALL"
  199.  
  200.     GETPATH:
  201.  
  202.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, "FHelpDlgProc")
  203.  
  204.     IF sz$ = "CONTINUE" THEN
  205.         szTitleDir$ = GetSymbolValue("EditTextOut")
  206.         IF IsDirWritable(szTitleDir$) = 0 THEN
  207.  
  208.             BADPATH:
  209.  
  210.             sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfoDlgProc", 0, "")
  211.             IF sz$ = "REACTIVATE" THEN
  212.                 GOTO BADPATH
  213.             END IF
  214.             UIPop 1
  215.             GOTO GETPATH
  216.         END IF
  217.         UIPop 1
  218.         CreateDir szTitleDir$, cmoNone
  219.  
  220.     ELSEIF sz$ = "REACTIVATE" THEN
  221.         GOTO GETPATH
  222.  
  223.     ELSE
  224.         szTitleDir$ = ""
  225.  
  226.     END IF
  227.  
  228.     GetTitleDir = szTitleDir$
  229.  
  230. END FUNCTION
  231.  
  232.  
  233. '*************************************************************************
  234. '** Purpose:
  235. '**     Copies the files in the INF file
  236. '** Arguments:
  237. '**     szTitleDir$ - destination directory for the title files
  238. '** Returns
  239. '**     1 if files were copied, 0 otherwise
  240. '*************************************************************************
  241.  
  242. FUNCTION CopyFiles(szTitleDir$) STATIC AS INTEGER
  243.  
  244.     '' Add all system files to the copy list
  245.     AddSectionFilesToCopyList "System Files", GetSymbolValue("STF_SRCDIR"), GetWindowsSysDir()
  246.     
  247.     '' Add all of the title files to the copy list
  248.     AddSectionFilesToCopyList "Installed Title Files", GetSymbolValue("STF_SRCDIR"), szTitleDir$
  249.     
  250.     '' Check size
  251.     szExtras$ = "Extra"
  252.     szCosts$ = "Costs"
  253.     szNeededs$ = "Neededs"
  254.     FOR i% = 1 TO 26 STEP 1
  255.         AddListItem szExtras$, "0"
  256.     NEXT i%
  257.     
  258.     '' We assume that VIEWER.INI will take another 4K
  259.     ReplaceListItem szExtras$, ASC(MID$(GetWindowsDir(), 1, 1)) - ASC("A") + 1, STR$(4096)
  260.     
  261.     '' Get amount of space required
  262.     StillNeed& = GetCopyListCost(szExtras$, szCosts$, szNeededs$)
  263.     
  264.     '' Put up a message if there is not enough space
  265.     FOR i% = 1 TO 26 STEP 1
  266.         IF VAL(GetListItem(szNeededs$, i%)) > 0 THEN
  267.     
  268.             SetSymbolValue "String1", LTRIM$(STR$(VAL(GetListItem(szCosts$, i%)) / 1024))
  269.             SetSymbolValue "String2", CHR$(i% - 1 + ASC("A"))
  270.     
  271.             TOOBIG:
  272.     
  273.             sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfoDlgProc", 0, "")
  274.             IF sz$ = "REACTIVATE" THEN
  275.                 GOTO TOOBIG
  276.             END IF
  277.             UIPop 1
  278.             CopyFiles = 0
  279.             GOTO DONTCOPY
  280.         END IF
  281.     NEXT i%
  282.     
  283.     '' Copy the files
  284.     CopyFilesInCopyList
  285.     
  286.     CopyFiles = 1
  287.  
  288. DONTCOPY:
  289.  
  290. END FUNCTION
  291.  
  292.  
  293. '*************************************************************************
  294. '** Purpose:
  295. '**     Puts up a success dialog
  296. '*************************************************************************
  297.  
  298.  SUB ShowSuccess STATIC
  299.  
  300.     SUCCESS:
  301.     
  302.     SetSymbolValue "String1", TitleShortName$
  303.     sz$ = UIStartDlg(CUIDLL$, SUCCESS, "FInfoDlgProc", 0, "")
  304.     IF sz$ = "REACTIVATE" THEN
  305.         GOTO SUCCESS
  306.     END IF
  307.     UIPop 1
  308.     
  309. END SUB
  310.  
  311.  
  312. '*************************************************************************
  313. '** Purpose:
  314. '**     Appends a file name to the end of a directory path,
  315. '**     inserting a backslash character as needed.
  316. '** Arguments:
  317. '**     szDir$  - full directory path (with optional ending "\")
  318. '**     szFile$ - filename to append to directory
  319. '** Returns:
  320. '**     Resulting fully qualified path name.
  321. '*************************************************************************
  322.  
  323. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  324.     IF szDir$ = "" THEN
  325.         MakePath = szFile$
  326.     ELSEIF szFile$ = "" THEN
  327.         MakePath = szDir$
  328.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  329.         MakePath = szDir$ + szFile$
  330.     ELSE
  331.         MakePath = szDir$ + "\" + szFile$
  332.     END IF
  333. END FUNCTION
  334.  
  335.  
  336. '*************************************************************************
  337. '** Purpose:
  338. '**     Registers a font.
  339. '** Arguments:
  340. '**     fontfile$ - font filename
  341. '**     fontname$ - font name.
  342. '*************************************************************************
  343.  
  344. SUB RegisterFont(fontfile$, fontname$) STATIC
  345.  
  346.     '' A simple error catching wrapper around AddFont, which is a 'C' routine in MSCUISTF.DLL
  347.  
  348.     IF AddFont(fontfile$, fontname$) = -1 THEN
  349.         j% = DoMsgBox("Could not install " + fontfile$ + " font.", "Viewer Font Installation", 0)
  350.     ENDIF
  351.  
  352. END SUB
  353.  
  354.  
  355. '*************************************************************************
  356. '** Purpose:
  357. '**     Registers title in VIEWER.INI
  358. '*************************************************************************
  359.  
  360. SUB ModifyViewerIni STATIC
  361.  
  362.     '' Get the VIEWER.INI file
  363.     
  364.     szIni$ = MakePath(GetWindowsDir(), "VIEWER.INI")
  365.  
  366.     '' First register the title file, setting the Name and Path entries. 
  367.     '' We assume that the MVB file is the same directory as SETUP.EXE.
  368.     ''
  369.     '' CUSTOMIZATION: If you're installing multiple MVB files, copy the
  370.     '' following two statements for each additional file, substituting
  371.     '' the appropriate long name and MVB filename for the TitleLongName$
  372.     '' and MVB$ variables.
  373.     
  374.     CreateIniKeyValue szIni$, MVB$, "Name", TitleLongName$, cmoOverwrite
  375.     CreateIniKeyValue szIni$, MVB$, "Path", GetSymbolValue("STF_SRCDIR"), cmoOverwrite
  376.     
  377.     '' Now we have to register the MVB file in the [FILES] section, so 
  378.     '' Viewer can find files that are not on the path and display a 
  379.     '' special message when a file is not found.
  380.  
  381.     CreateIniKeyValue szIni$, "FILES", MVB$ + ".MVB", GetSymbolValue("STF_SRCDIR") + "," + "Please insert the " + TitleLongName$ + " disk.", cmoOverwrite
  382.  
  383.     '' CUSTOMIZATION: If you're installing a Help title or any custom DLLs,
  384.     '' you should copy the preceding statement for each extra title or DLL.
  385.     ''
  386.     '' Example for installing an extra title:
  387.     ''
  388.     ''    CreateIniKeyValue szIni$, "FILES", "GALHELP.MVB", GetSymbolValue("STF_SRCDIR") + "," + "Please insert the Viewer 2.0 Gallery disk.", cmoOverwrite
  389.     ''
  390.     '' Example for installing a custom DLL:
  391.     ''
  392.     ''    CreateIniKeyValue szIni$, "FILES", "GALLERY.DLL", GetSymbolValue("STF_SRCDIR") + "," + "A required file is missing. Please reinstall the Viewer Gallery.", cmoOverwrite
  393.  
  394. END SUB
  395.  
  396.  
  397. '*************************************************************************
  398. '** Purpose:
  399. '**     Creates program manager entries for the title
  400. '*************************************************************************
  401.  
  402. SUB ModifyProgramManager STATIC
  403.  
  404.     '' Create the program manager group
  405.  
  406.     CreateProgmanGroup ProgmanGroup$, "", cmoNone
  407.     ShowProgmanGroup ProgmanGroup$, 1, cmoNone
  408.     
  409.     '' Create an entry for the title
  410.      
  411.     CreateProgmanItem ProgmanGroup$, ProgmanItem$, "mviewer2.exe " + MakePath(GetSymbolValue("STF_SRCDIR"), MVB$ + ".MVB"), MakePath(GetSymbolValue("STF_SRCDIR"), "BUS500.ICO") + ",0,0,0," + GetSymbolValue("STF_SRCDIR") + "BUS500", cmoOverwrite
  412.     CreateProgmanItem ProgmanGroup$, CatProgmanItem$, "mviewer2.exe " + MakePath(GetSymbolValue("STF_SRCDIR"), CATMVB$ + ".MVB"), MakePath(GetSymbolValue("STF_SRCDIR"), "CATALOG.ICO") + ",0,0,0," + GetSymbolValue("STF_SRCDIR") + "BUS500", cmoOverwrite
  413.     CreateProgmanItem ProgmanGroup$, "Read Me: Allegro Multimedia Business 500", "write.exe " + GetSymbolValue("STF_SRCDIR") + "readme.wri", "", cmoOverwrite
  414.     CreateProgmanItem ProgmanGroup$, "Prodigy Installation", "" + MakePath(GetSymbolValue("STF_SRCDIR"), "PRODIGY\INSTALL.EXE"), MakePath(GetSymbolValue("STF_SRCDIR"), "PRODIGY.ICO") + ",0,0,0," + GetSymbolValue("STF_SRCDIR") + "PRODIGY", cmoOverwrite
  415.  
  416.  
  417. '' CUSTOMIZATION: 
  418.     ''
  419.     '' To create additional Program Manager items, copy the preceding 
  420.     '' statement for each additional item, substituting the appropriate
  421.     '' name for the MVB$ variable.
  422.     ''
  423.     '' To display a custom icon with the Program Manager item, specify
  424.     '' the icon filename with the fourth parameter (this parameter is 
  425.     '' currently an empty string, ""). The following example specifies 
  426.     '' an icon with the same filename as the .MVB file:
  427.     ''
  428.     ''        CreateProgmanItem ProgmanGroup$, ProgmanItem$, "mviewer2.exe " + MakePath(GetSymbolValue("STF_SRCDIR"), MVB$ + ".MVB"), MakePath(GetSymbolValue("STF_SRCDIR"), MVB$ + ".ICO"), cmoOverwrite
  429.  
  430. END SUB
  431.  
  432.  
  433. '*************************************************************************
  434. '** Purpose:
  435. '**     Registers custom fonts with Windows.
  436. '*************************************************************************
  437.  
  438. SUB RegisterCustomFonts STATIC
  439.  
  440.     '' CUSTOMIZATION: If you install custom fonts, then add statements
  441.     '' in this routine to register the fonts with the current Windows 
  442.     '' session and to add them to the WIN.INI [Fonts] section. 
  443.     ''
  444.     '' Note that TrueType fonts can only be installed in Windows 3.1.
  445.     '' RegisterFont automatically creates the required .FOT file for 
  446.     '' TrueType fonts.
  447.     ''    
  448.     '' The following example registers a font residing in MISTRAL.TTF
  449.     '' and installs the font with the name Mistral (True Type):
  450.     '' 
  451.     ''     RegisterFont "mistral.ttf", "Mistral (TrueType)"
  452.     ''
  453.  
  454. END SUB
  455.  
  456.  
  457. '*************************************************************************
  458. '** Purpose:
  459. '**     Registers Windows drivers
  460. '*************************************************************************
  461.  
  462. SUB RegisterDrivers STATIC
  463.  
  464. '' CUSTOMIZATION: Video for Windows is not a standard component of
  465. '' Windows 3.1. If your title uses video, proceed as follows.
  466. ''
  467. '' 1) Add the following files to the [System Files] section of the INF file:
  468. ''
  469. ''    dispdib.dll
  470. ''    msvideo.dll
  471. ''    indeo.drv
  472. ''    mciavi.drv
  473. ''    msvidc.drv
  474. ''
  475. '' 2) Add the above files to your release directory. US versions can be 
  476. ''    found in the \SYSTEM subdirectory of your Viewer disc. French and
  477. ''    German versions were not available at ship time. Please contact 
  478. ''    Microsoft or check the Multimedia Viewer section on the Microsoft
  479. ''    Compuserve Forum for further details.
  480. ''
  481. '' 3) Uncomment the following lines:
  482. ''
  483. CreateIniKeyValue "WIN.INI", "mci extensions", "AVI", "AVIVIDEO", cmoNone
  484. CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "mci", "AVIVIDEO", "MCIAVI.DRV", cmoNone
  485. CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "drivers", "vidc.msvc", "msvidc.drv", cmoNone
  486. CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "drivers", "vidc.rt21", "indeo.drv", cmoNone
  487. CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "drivers", "VIDC.IV31", "ir32.dll", cmoNone
  488. CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "drivers", "VIDC.IV32", "ir32.dll", cmoNone
  489.  
  490. END SUB
  491.  
  492.  
  493.  
  494.